<template>
  <div class="box" v-loading="show">
    <div class="main">
      <div class="time">{{count}}秒过后，自动返回{{name?'首页':'登录页'}}~~</div>
      <div class="img">
        <img src="https://img0.baidu.com/it/u=3614630412,3252747723&fm=253&fmt=auto&app=138&f=JPEG?w=900&h=462" alt="">
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'App',
  data() {
    return {
      count: 10,
      name: localStorage.getItem('identity'),
      show:true
    }
  },
  created() {
    if (localStorage.getItem('identity')) {
     
        this.$router.push({
          path: '/areaDetail' 
        })
        // location.href = location.href + "";
        // location.reload();
      
    }
  },
  mounted() {

    var times = setInterval(() => {
      this.show=false
      this.count--;
      if (this.count <= 0) {
        this.show=true
        clearInterval(times);
        if (localStorage.getItem('identity')) {

          this.$router.push('/areaDetail')
        } else {
          this.$router.push("/")
        }

      }
    }, 1000);
  }
}
</script>
<style scoped lang='scss'>
.box {
  display: flex;
  flex-direction: column;
  text-align: center;
  height: 100vh;
  width: 100vw;
  background-color: #3f3a39;
  .main {
    margin: auto;
    .time {
      color: #fff;
      margin-bottom: 10px;
    }
  }
}
</style>